package com.zretc.service.impl;

import com.zretc.dao.IndexShowMapper;
import com.zretc.entity.IndexModel;
import com.zretc.service.IndexShowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author  吴凯
 * 首页渲染业务层 实现类
 */
@Service
public class IndexShowServiceImpl implements IndexShowService {
    @Autowired
    private IndexShowMapper indexShowMapper;
    @Override
    public List<IndexModel> getEightNewMovies() {
        return indexShowMapper.findEightNewMovies();
    }

    @Override
    public List<IndexModel> getEightHotMovies() {
        return indexShowMapper.findEightHotMovies();
    }

    @Override
    public List<IndexModel> getTheUpcomingMovies() {
        return indexShowMapper.theUpcomingMovies();
    }
   @Override
   public Map<String,List<IndexModel>> threeToOneShow() {

       List<IndexModel> theUpcomingMovies = indexShowMapper.theUpcomingMovies();
       List<IndexModel> eightNewMovies = indexShowMapper.findEightNewMovies();
       List<IndexModel> eightHotMovies = indexShowMapper.findEightHotMovies();
       Map<String,List<IndexModel>> map = new HashMap<>();
       map.put("theUpcomingMovies",theUpcomingMovies);
       map.put("eightNewMovies",eightNewMovies);
       map.put("eightHotMovies",eightHotMovies);
       return map;
   }
}
